package org.jeecg.modules.demo.zjzx.service.impl;

import org.jeecg.modules.demo.zjzx.entity.ZwglWt;
import org.jeecg.modules.demo.zjzx.entity.ZwglZjhd;
import org.jeecg.modules.demo.zjzx.mapper.ZwglWtMapper;
import org.jeecg.modules.demo.zjzx.mapper.ZwglZjhdMapper;
import org.jeecg.modules.demo.zjzx.service.IZwglZjhdService;
import org.springframework.stereotype.Service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Description: 专家回答
 * @Author: jeecg-boot
 * @Date:   2023-04-20
 * @Version: V1.0
 */
@Service
public class ZwglZjhdServiceImpl extends ServiceImpl<ZwglZjhdMapper, ZwglZjhd> implements IZwglZjhdService {
	
	@Autowired
	private ZwglZjhdMapper zwglZjhdMapper;
	@Autowired
	private ZwglWtMapper zwglWtMapper;
	
	@Override
	public List<ZwglZjhd> selectByMainId(String mainId) {
		return zwglZjhdMapper.selectByMainId(mainId);
	}

	@Override
	@Transactional
	public void mySave(ZwglZjhd zwglZjhd) {
		baseMapper.insert(zwglZjhd);
		ZwglWt zwglWt = new ZwglWt();
		zwglWt.setId(zwglZjhd.getWj());
		zwglWt.setZt("已回答");
		zwglWtMapper.updateById(zwglWt);
	}
}
